<?php

namespace app\modules\api\controllers;

use app\models\User;
use Yii;
use app\models\Game;
use app\modules\api\CommonController;
use app\models\MiniprogramSession;



class LoginController extends CommonController
{
    protected $check_login = 0;
    public function actionLogin($appid,$code = null){
        try{
            $obj = MiniprogramSession::login($appid,$code);
            return $this->success([
                'sid'=>$obj->sid,
            ]);

        }catch (\Exception $e){
            return $this->error($e);
        }
    }
    //小程序登录
    public function actionMiniProgram($appid,$code = null)
    {
        try{
            $obj = MiniprogramSession::login($appid,$code);
            return $this->success([
                'sid'=>$obj->sid,
            ]);

        }catch (\Exception $e){
            return $this->error($e);
        }
    }
}
